package your.rpg.namespace;

import java.util.ArrayList;

public class Level {//each level gets one Event instance which has a number of arrays that contain event info
	//the panel class will sent event data to a handler that converts the raw into data for the ondraw function.. 
	private Event eventlist;
	private ArrayList<LevelObject> objects;
	private int levelNumber;
	private String levelName;
	private int background;
	
	public Level(int naam, int bg, String level,int level1, int level2, int level3,String point1, String point2, String point3){
		levelName = level;
		levelNumber = naam;
		background = bg;
		eventlist = new Event(level1,level2,level3,point1,point2,point3);
		objects = new ArrayList<LevelObject>();
	}
	
	public int getLevelNumber(){
		return levelNumber;
	}
	
	public int getBackground(){
		return background;
	}
	
	public int getObjectImage(int index){
		return objects.get(index).getImage();
	}
	
	public int getObjectXpos(int index){
		return objects.get(index).getXpos();
	}
	
	public int getObjectYpos(int index){
		return objects.get(index).getYpos();
	}
	
	public int getObjectAmount(){
		return objects.size();
	}
	
	public String getEvent(String event,int index){
		return eventlist.getEvent(event,index);
	}

	public void setObjectPos(int index,int x, int y){
		objects.get(index).setPos(x,y);
	}
	
	public void setObjectImage(int index, int image){
		objects.get(index).setImage(image);
	}

	public void addObject(String naam,int imageid,int x,int y){
		objects.add(new LevelObject(naam,imageid,x,y));
	}
	
	public void addEvent(String listname, String action){
		eventlist.addEvent(listname,action);
	}
	
	public void removeObject(int index){
		objects.remove(index);
	}
	
	public int getListSize(String list_name){
		return eventlist.getListSize(list_name);
	}
	
	public String getLevelName(){
		return levelName;
	}
	
	public int getEventId(int number){
		return eventlist.getName(number);
	}
	
	public String getEventPointId(int number){
		return eventlist.getPointName(number);
	}
}
